package com.inspinia.upms.common.model.dept;


import com.inspinia.base.common.model.NameCodeEnum;

/**
 * Created by WangJun on 2018/1/25.
 */
public enum UpmsDeptType implements NameCodeEnum {
    development(1, "研发部"),
    technical(2, "技术部"),
    personnel(3, "人事部");

    private final int code;
    private final String name;

    UpmsDeptType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getName() {
        return name;
    }

    public static UpmsDeptType valueOf(int code) {
        for (UpmsDeptType departmentType : UpmsDeptType.values()) {
            if (departmentType.code == code) {
                return departmentType;
            }
        }
        return null;
    }

    public UpmsDeptType getValue(int code) {
        for (UpmsDeptType departmentType : UpmsDeptType.values()) {
            if (departmentType.getCode() == code) {
                return departmentType;
            }
        }
        return null;
    }
}
